//
//  MediaInfoModel.m
//  MediaInfoGUI
//
//  Created by Olivier Larivain on 2/6/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "MediaInfoModel.h"


@implementation MediaInfoModel
@synthesize documentInfos;
@synthesize html;
@synthesize text;
@synthesize general;
@synthesize generalMetaData;
@synthesize video;
@synthesize audio1;
@synthesize audio2;
@synthesize text1;
@synthesize text2;
@synthesize text3;

-(id) init
{
  [super init];
  documentInfos = [[NSMutableArray alloc] init];
  video = [[NSAttributedString alloc] initWithString: @""];
  audio1 = [[NSAttributedString alloc] initWithString: @""];
  audio2 = [[NSAttributedString alloc] initWithString: @""];
  text1 = [[NSAttributedString alloc] initWithString: @""];
  
  return self;
}

- (void) clear
{
  [documentInfos removeAllObjects];
  [self setHtml:[[NSAttributedString alloc] init]];
  [self setText:[[NSAttributedString alloc] init]];
  [self setGeneral:[[NSAttributedString alloc] init]];
  [self setGeneralMetaData:[[NSAttributedString alloc] init]];
  [self setVideo:[[NSAttributedString alloc] init]];
  [self setAudio1:[[NSAttributedString alloc] init]];
  [self setAudio2:[[NSAttributedString alloc] init]];
  [self setText1:[[NSAttributedString alloc] init]];
  [self setText2:[[NSAttributedString alloc] init]];
  [self setText3:[[NSAttributedString alloc] init]];
  [self setGeneral:[[NSAttributedString alloc] init]];
}

- (void) addDocument: (DocumentInfo *) info
{
  [self willChangeValueForKey: @"documentInfos"];
  [[self documentInfos] addObject:info];
  [self didChangeValueForKey:@"documentInfos"];
}

- (int) documentCount
{
  return [documentInfos count];
}
@end
